package com.cloud.cop.validation;

import java.util.EnumMap;

/**
 * <pre>
 * 		子错误类型
 * </pre>
 * @author Administrator
 *
 */
public enum SubErrorType {
	
	//服务器子错误
	ISP_SERVICE_UNAVAILABLE,//服务错误
    ISP_REMOTE_SERVICE_ERROR,//远程服务器错误
    ISP_REMOTE_SERVICE_TIMEOUT,//远程服务连接超时
    ISP_REMOTE_CONNECTION_ERROR,//远程服务连接错误
    ISP_NULL_POINTER_EXCEPTION,//空指针
    ISP_COP_PARSE_ERROR,//COP平台类型转换错误
    ISP_COP_REMOTE_CONNECTION_TIMEOUT,//COP平台连接超时
    ISP_COP_REMOTE_CONNECTION_ERROR,//COP平台连接错误
    ISP_COP_MAPPING_PARSE_ERROR,//COP平台类型转换失败
    ISP_UNKNOWN_ERROR,//未知错误

    //业务子错误
    ISV_NOT_EXIST,//业务对象不存在
    ISV_MISSING_PARAMETER,//缺少参数
    ISV_INVALID_PARAMETE,//参数不对
    ISV_INVALID_PERMISSION,//权限不对
    ISV_PARAMETERS_MISMATCH;//参数不匹配
	
	public static final EnumMap<SubErrorType,String>  errorMap = new EnumMap<SubErrorType,String>(SubErrorType.class);
	
	static {
		errorMap.put(SubErrorType.ISV_NOT_EXIST, "isv.xxx-not-exit:invalid-yyy");
		errorMap.put(SubErrorType.ISV_MISSING_PARAMETER, "isv.missing-parameter:xxx");
		errorMap.put(SubErrorType.ISV_INVALID_PARAMETE, "isv.invalid-parameter:xxx");
		errorMap.put(SubErrorType.ISV_INVALID_PERMISSION, "isv.invalid-permission");
		errorMap.put(SubErrorType.ISV_PARAMETERS_MISMATCH, "isv.parameters-mismatch");
		errorMap.put(SubErrorType.ISP_SERVICE_UNAVAILABLE, "isp.service-unavailable");
		errorMap.put(SubErrorType.ISP_REMOTE_SERVICE_ERROR, "isp.remote-service-error");
		errorMap.put(SubErrorType.ISP_REMOTE_SERVICE_TIMEOUT, "isp.remote-service-timeout");
		errorMap.put(SubErrorType.ISP_REMOTE_CONNECTION_ERROR, "isp.remote-connection-error");
		errorMap.put(SubErrorType.ISP_NULL_POINTER_EXCEPTION, "isp.null-pointer-exception");
		errorMap.put(SubErrorType.ISP_COP_PARSE_ERROR, "isp.cop-parse-error");
		errorMap.put(SubErrorType.ISP_COP_REMOTE_CONNECTION_TIMEOUT, "isp.cop-remote-connection-timeout");
		errorMap.put(SubErrorType.ISP_COP_REMOTE_CONNECTION_ERROR, "isp.cop-remote-connection-error");
		errorMap.put(SubErrorType.ISP_COP_MAPPING_PARSE_ERROR, "isp.cop-mapping-parse-error");
		errorMap.put(SubErrorType.ISP_UNKNOWN_ERROR, "isp.unknown-error");
	}
	
	
	public String value() {
        return errorMap.get(this);
    }
	
}
